//父类

class Item {
  constructor(data = {}) {
    this.id = data.id;
    //位置
    this.x = data.x;
    this.y = data.y;

    //大小
    this.w = data.w;
    this.h = data.h;
  }

  //格式化数据以便发送给前端
  serializeForUpdate() {
    return {
      id: this.id,
      x: this.x,
      y: this.y,
      w: this.w,
      h: this.h,
    };
  }
}

module.exports = Item;
